# -*- coding: utf-8 -*-
# @File: backend => user_schema.py
# @CreateTime: 2025/8/26 09:24
# @Author: EvanZhang
# @Info:

from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime

class UserRegisterRequest(BaseModel):
    username: str = Field(..., max_length=50, description="用户名")
    password: str = Field(..., min_length=6, max_length=128, description="密码")

class UserLoginRequest(BaseModel):
    username: str = Field(..., max_length=50, description="用户名")
    password: str = Field(..., min_length=6, max_length=128, description="密码")
    # 后面还要添加验证码字段扩展

class UserBase(BaseModel):
    id: int
    username: str
    avatar_url: Optional[str] = None
    chips: int
    created_at: datetime

# JWT Token模型
class Token(BaseModel):
    token: str = None

class UserLoginResponse(BaseModel):
    userinfo:UserBase
    usertoken: Token

class UserProfileRequest(BaseModel):
    avatar_url: Optional[str] = Field(None, description="头像URL")
